# encoding=utf-8

from search import Stack
from tree_search import TreeSearch
from graph_search import GraphSearch
'''
Created on Nov 21, 2012

@author: junior
'''

class DFS(object):

	def __init__(self, problem, model, limit='Inf'):
		self._problem = problem
		self._model = model
		self._frontier = Stack()
		self._limit = limit

	def execute(self):
		if self._model == 'tree':
			tree_search = TreeSearch(self._problem, Stack(), limit=self._limit)
			result = tree_search.execute()
			return result
		else:
			graph_search = GraphSearch(self._problem, Stack())
			result = graph_search.execute()
			return result
